package cn.daniel.commonutils.exceptionhandler.exception;

import cn.daniel.commonutils.result.ResultCode;
import lombok.Data;

@Data
public class MyException extends RuntimeException{
    private Integer code;
    private String msg;

    private MyException(Integer code,String msg){
        super(msg);
        this.setCode(code);
        this.setMsg(msg);

    }
    private MyException(String msg){
        super(msg);
        this.setMsg(msg);
    }

    public static MyException setException(ResultCode resultCode){
        return new MyException(resultCode.getCode(),resultCode.getMessage());
    }
    public static MyException setException(String message){
        return new MyException(message);

    }

}
